import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}

// --------------   用户 -----------//
export function List(params) {
  return request({
    url: '/user/list',
    method: 'get',
    params: params
  })
}

// 身份类型列表
export function Type() {
  return request({
    url: '/user/type',
    method: 'get'
  })
}

// 设置身份
export function SetType(data) {
  return request({
    url: '/user/setType',
    method: 'put',
    data
  })
}

export function Del(query) {
  return request({
    url: '/user/del',
    method: 'delete',
    params: query
  })
}

export function Status(data) {
  return request({
    url: '/user/status',
    method: 'put',
    data
  })
}
export function Save(query) {
  return request({
    url: 'user/infoSave',
    method: 'post',
    params: query
  })
}

export function GetUserCompanyId(query) {
  return request({
    url: '/user/companyId',
    method: 'get',
    params: query
  })
}

export function SyncUser(data) {
  return request({
    url: '/user/sync',
    method: 'put',
    data
  })
}
